<link rel="stylesheet" type="text/css" href="<?php echo $this->webroot . '/theme/default/u22'; ?>/css/stats.css"/>
<script>
    var url = 0;
    $(document).ready(function(){
        change_menu_class('m_2');
        <?php if($id):?>
        $("#item_<?php echo $id;?>").attr('checked', 'checked');
            url = <?php echo $id;?>;
        <?php endif;?>
        //alert(11);
        show_select();
    });

    function ss() {
        var id  = '<?php echo $id;?>';
        var ss  = $("#check_uhash");
        if(ss.length == 1 && id == ''){
            select_go();
        }
    }
    function select_go() {
        var url = '<?php echo url_for('user/over_view/id/');?>';
        var s   = $("#check_uhash option:selected").val();
        location.href   = "<?php echo url_for('user/over_view/id/');?>"+s+"/";
    }
    function show_select() {
        var str = '';
        var id = $("item_"+url).attr('lable');
        $.ajax({
            url:"<?php echo url_for('servlet/my_url_list');?>",
            dataType:"json",
            success:function(data){
                //str = "<option id='item_0'>请选择</option>";
                $.each(data.data, function(k,v){
                    str +="<option value='"+v.id+"' id=item_"+v.id+" lable="+v.uhash+">"+v.title+"</option>";
                });
                $("#check_uhash").append(str);
                if(url != '' && url != 0) {
                    //get_month_count();
                }
                if(url !=0 && url !='') {
                    setTimeout(function() {
                       $("#item_"+url).attr('selected', true);
                    }, 1);

                }
            }
        });
    }
</script>
<div class="content">
    <?php echo get_block('user', 'left');?>
    <div class="info">
        <h3>访问概况-请选择短网址</h3>
        <p>标题:<select id="check_uhash" onchange="select_go();">
                <option value="0" id="item_0" lable="0">请选择</option>
            </select>
        </p>
    </div>
    <?php if($rs):?>
    <div class="info">
                <table class="overview_data" style="font-size: 12px;">
                <tbody><tr>
                        <td style="width:270px">
                            <table style="width:270px" id="SiteMain_2">
                                <tbody>
                                    <tr class="fonts"><td>&nbsp;</td><td><strong>访问量</strong></td><td><strong>浏览量</strong></td></tr>
                                    <tr class="fonts today"><td class="tleft">今日流量:</td><td><?php echo $today_ip;?> IP</td><td><?php echo $today_pv;?> PV</td></tr>
                                    <tr><td class="tleft">昨日流量:</td><td><?php echo $yesday_ip;?> IP</td><td><?php echo $yesday_ip;?> PV</td></tr>
                                </tbody></table>
                        </td>
                        <td style="width:10px">&nbsp;</td>
                        <td style="width:220px">
                            <table>
                                <tbody><tr><td>&nbsp;</td></tr>
                                    <tr><td style="text-align:right">最高访问量:</td><td style="text-align:left"><?php echo $total_ip->getIp();?> IP</td></tr>
                                    <tr><td style="text-align:right">发生在:</td><td style="text-align:left"><?php echo substr($total_ip->getLogTime(), 0,4).'-'.  substr($total_ip->getLogTime(), 4,2).'-'.  substr($total_ip->getLogTime(), 6,2);?></td></tr>
                                    <tr><td colspan="2">&nbsp;</td></tr>
                                    <tr><td style="text-align:right">最高浏览量:</td><td style="text-align:left"><?php echo $total_pv->getPv();?> PV</td></tr>
                                    <tr><td style="text-align:right">发生在:</td><td style="text-align:left"><?php echo substr($total_pv->getLogTime(), 0,4).'-'.  substr($total_pv->getLogTime(), 4,2).'-'.  substr($total_pv->getLogTime(), 6,2);?></td></tr>
                                </tbody></table>
                        </td>
                    </tr>
                </tbody></table>
        <h3>基本统计信息</h3>
        <table style="padding: 10px;font-size: 12px;">
            <tr>
                <td></td>
                <td>访问量</td>
                <td>浏览量</td>
            </tr>
            <tr>
                <td>总量：</td>
                <td><?php echo $rs->getTotalIp();?>IP</td>
                <td><?php echo $rs->getTotalPv();?>PV</td>
            </tr>
            <tr>
                <td></td>
                <td>访问量</td>
                <td>浏览量</td>
            </tr>

       </table>
    </div>
    <?php endif;?>
</div>